#define _CRT_SECURE_NO_WARNINGS	

double sequence(int n)
{
    if (n == 1)
        return 1;
    double sum = 1;
    double ret = 1;
    for (int i = 1; i < n; i++)
    {
        sum = 1 / (5 + sum);
        ret += sum;
    }
    return ret;
}